import 'package:flutter/material.dart';
import '../../common/utils/screen_util.dart';
import '../resources/colors.dart';

class MyDiv extends StatelessWidget {
  final bool vertical;
  final double thickness;
  final Color? color;

  const MyDiv(
      {super.key, this.vertical = false, this.thickness = 1, this.color});

  factory MyDiv.vertical({double thickness = 1, Color? color}) {
    return MyDiv(vertical: true, thickness: thickness, color: color);
  }

  factory MyDiv.onePixel({bool vertical = false, Color? color}) {
    return MyDiv(
        vertical: vertical,
        thickness: MyScreen.onePixel,
        color: color ?? JmColors.div);
  }

  factory MyDiv.verticalOnePixel({Color? color}) {
    return MyDiv.onePixel(vertical: true, color: color);
  }

  @override
  Widget build(BuildContext context) {
    if (vertical) {
      return Container(
        width: thickness,
        color: color ?? JmColors.div,
      );
    }

    return Container(
      height: thickness,
      color: color ?? JmColors.div,
    );
  }
}
